'use strict';

const Controller = require('egg').Controller;

class NewController extends Controller {
  async list() {
    const ctx = this.ctx;
    const page = ctx.query.page || 1;
    const newsList = await ctx.service.new.list(page);
    await ctx.render('list.tpl', newsList);
    // const dataList = {
    //   list: [
    //     { id: 1, title: 'this is news 1', url: '/news/1' },
    //     { id: 2, title: 'this is news 2', url: '/news/2' },
    //   ],
    // }
    // await this.ctx.render('list.tpl', dataList)
  }
}

module.exports = NewController;
